package jwdt.xadmin.custom.service.impl;

import java.util.List;

import jwdt.common.dao.BaseDao;
import jwdt.xadmin.custom.bean.TCarwh;
import jwdt.xadmin.custom.service.CarwhManageService;
import jwdt.xadmin.system.bean.TSystem;

import com.ezerg.db.Jdb;
import com.ezerg.db.ext.PageUtil;
import com.ezerg.web.Form;
import com.ezerg.web.Module;

public class CarwhManageServiceImpl implements CarwhManageService {

	private BaseDao<TCarwh> baseDao;
	
	public void setBaseDao(BaseDao<TCarwh> baseDao) {
		this.baseDao = baseDao;
	}
	
	
	@Override
	public String carwhAddact(TCarwh obj) throws Exception{
		return baseDao.doAddObj(obj);
	}


	@Override
	public TCarwh carwhEdit(int id) throws Exception{
		return baseDao.doLoadObj(TCarwh.class,id);
	}


	@Override
	public String carwhEditact(TCarwh obj,int id) throws Exception{
		
	return baseDao.doUpdateObj(TCarwh.class,id,obj);
	}


	@Override
	public String carwhDel(int id) throws Exception{
		return baseDao.doDelObj(TCarwh.class,id);
	}


	@Override
	public PageUtil pageCarwh(Form f, Module m) throws Exception{
		TSystem Tsystem=(TSystem) Jdb.get().get(TSystem.class, 1);
		int page = f.getInt("page", 1);
		int pageSize = f.getInt("pageSize", Tsystem.getAdminnum());
		
		String sql = " order by id desc";

		PageUtil pu = new PageUtil(TCarwh.class, sql, page, pageSize);
		return pu.setUrl(m.getFullPath() + ".do");
	}
	@Override
	public List cpxxWh() throws Exception{
		
		return Jdb.get().query("SELECT cph FROM t_car");
	}
}
